package com.lyk.coursearrange.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lyk.coursearrange.dao.IOperLogDao;
import com.lyk.coursearrange.entity.OperLog;
import com.lyk.coursearrange.entity.dto.OperLogDto;
import com.lyk.coursearrange.service.IOperLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class IOperLogServiceImpl extends ServiceImpl<IOperLogDao, OperLog> implements IOperLogService
{
    @Autowired
    private IOperLogDao operLogMapper;

    @Override
    public List<OperLogDto> selectOperLogList(Map<String,String> param)
    {
        Long page = null;
        Long limit = null;
        Long offset =null;
        if(param.get("page")!=null&&!param.get("page").equals("")){
            page = Long.valueOf(param.get("page"));
        }
        if(param.get("limit")!=null&&!param.get("limit").equals("")){
            limit = Long.valueOf(param.get("limit"));
        }
        if (page!=null&&limit!=null){
            offset =   (page - 1) * limit;
        }

        return operLogMapper.selectOperLogList(offset,limit);
    }

    @Override
    public int insertOperlog(OperLog operLog) {
        return operLogMapper.insert(operLog);
    }
}
